<template>
  <div :style="{ backgroundImage: `url(${picUrl})` }" class="play_list_item">
    <div class="header">
      <span class="iconfont icon-kaishi1"></span>
      <span class="play_count">{{ numberFormat(item.playCount) }}</span>
    </div>

    <div class="paly_btn">
      <span class="iconfont icon-kaishi1"></span>
    </div>

    <div class="title">
      <p>{{ item.name }}</p>
    </div>
  </div>
</template>

<script setup lang="ts">
import { computed } from 'vue'

import { numberFormat, coverFormat } from '@renderer/utils/format'

const props = defineProps({
  item: {
    type: Object,
    default: () => {}
  }
})

const picUrl = computed(() => {
  return coverFormat(props.item.picUrl)
})
</script>

<style scoped lang="scss">
.play_list_item {
  width: 22%;
  height: 33vh;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px 1.29%;
  padding: 10px;
  position: relative;
  box-sizing: border-box;
  background-position: center;
  background-size: cover;
  border-radius: 10px;
  overflow: hidden;

  .header {
    width: 100%;
    height: 30px;
    color: #f5f5f5;
    line-height: 30px;
    display: flex;
    align-items: center;
    justify-content: flex-end;

    .play_count {
      font-weight: 700;
    }
    .iconfont {
      font-size: 12px;
      transform: scale(0.8);
      margin-right: 3px;
    }
  }

  .paly_btn {
    flex: 1;
    display: flex;
    justify-self: center;
    align-items: center;
    margin-bottom: 50px;
    opacity: 0;
    transition: all 0.3s;
    span {
      font-size: 50px;
    }
  }
  &:hover .paly_btn {
    opacity: 1;
  }

  .title {
    height: 55px;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 5px 10px;
    backdrop-filter: blur(20px);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}
</style>
